--编写者：萌新小猫
--功能介绍：开启小丑牌游戏时，随机的人物中必定有温蒂
--使用方法：直接粘贴到模组环境 "herta"改成角色标签

AddPrefabPostInit("balatro_machine", function(inst)
    if not TheWorld.ismastersim then
        return inst
    end
    if inst.components.activatable then
        local oldOnActivate = inst.components.activatable.OnActivate
        inst.components.activatable.OnActivate = function(inst, doer, ...)
            if doer and doer:HasTag("herta") then
                local oldPickSome = GLOBAL.PickSome
                GLOBAL.PickSome = function(num, choices)
                    local ret = oldPickSome(num, choices)
                    if table.contains(choices, "herta") then
                        if not table.contains(ret, "herta") then
                            ret[#ret] = "herta"
                        end
                    end
                    return ret
                end
                oldOnActivate(inst, doer, ...)
                GLOBAL.PickSome = oldPickSome
                return
            end
            return oldOnActivate(inst, doer, ...)
        end
    end
end)
